package com.cgtong.android.mvp.model;

import com.cgtong.android.bean.ActivityBean;
import com.cgtong.android.bean.BannerBean;
import com.cgtong.android.bean.NewsBean;
import com.cgtong.android.http.ApiManager;
import com.cgtong.android.http.ConstantManager;
import com.cgtong.android.mvp.contract.HomeContract;
import com.youth.banner.Banner;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.CallBackProxy;
import com.zhouyou.http.callback.SimpleCallBack;
import com.zhouyou.http.model.ApiResult;

import java.util.List;

/**
 * Created by Sky.Bing on 2017/10/24.
 */

public class HomeModel implements HomeContract.Model {
    @Override
    public void getActivities(SimpleCallBack callBack) {
        EasyHttp.post(ApiManager.URL_GET_ACTIVITIES)
                .params("maxId", "0")
                .params("pagesize", String.valueOf(ConstantManager.HOME_MAX_ACTIVITIES))
                .execute(new CallBackProxy<ApiResult<List<ActivityBean>>, List<ActivityBean>>(callBack) {
                });
    }

    @Override
    public void getHotNews(SimpleCallBack callBack) {
        EasyHttp.post(ApiManager.URL_GET_HOMENEWS)
                .params("maxtime", "0")
                .params("pageSize", String.valueOf(ConstantManager.HOME_MAX_NEWS))
                .execute(new CallBackProxy<ApiResult<List<NewsBean>>, List<NewsBean>>(callBack) {
                });
    }

    @Override
    public void getBannerList(SimpleCallBack callBack) {
        EasyHttp.post(ApiManager.URL_GET_BANNER_LIST)
                .params("columnId", String.valueOf(ConstantManager.BANNER_COLUMN_HOME))
                .execute(new CallBackProxy<ApiResult<List<BannerBean>>, List<BannerBean>>(callBack) {
                });
    }
}